Skip to contentSkip to conversation

ctfconvert problems with build on illumos based platform

DISCUSSION Igor Kozhukhov 3 participants 5 messages Jan 14, 2014 – Jan 15, 2014

lore
Share & tools
lore
#1 lore raw
Quoted 6 lines · Igor Kozhukhov

Hello All,

I have problems with ctfconvert with build sources of xen-4.2 on illumos based platform:
https://www.illumos.org/issues/3205

Quoted 8 lines

could you please let me know - what the reason to have a variable in structure 'struct hvm_hw_cpu_xsave' with zero size:
struct { char x[0]; } ymm; /* YMM */
--
Best regards,
Igor Kozhukhov

The structure is variable length depending on whether the VM has enabled AVX support.

It is rather unfortunate that we have non-complient C used to specify the ABI.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 15 lines · Andrew Cooper
Quoted 5 lines · Igor Kozhukhov

Hello All,

I have problems with ctfconvert with build sources of xen-4.2 on illumos based platform:
https://www.illumos.org/issues/3205

Quoted 8 lines

could you please let me know - what the reason to have a variable in structure 'struct hvm_hw_cpu_xsave'
with zero size:
struct { char x[0]; } ymm; /* YMM */
--
Best regards,
Igor Kozhukhov

Quoted 3 lines

The structure is variable length depending on whether the VM has enabled AVX support.

It is rather unfortunate that we have non-complient C used to specify the ABI.

can we use here ?
struct { char x[1]; } ymm;

it will fix my problem.

-Igor

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 25 lines · Igor Kozhukhov
Quoted 16 lines · Andrew Cooper
Quoted 6 lines · Igor Kozhukhov

Hello All,

I have problems with ctfconvert with build sources of xen-4.2 on illumos based platform:
https://www.illumos.org/issues/3205

Quoted 8 lines

could you please let me know - what the reason to have a variable in structure 'struct hvm_hw_cpu_xsave' with zero size:
struct { char x[0]; } ymm; /* YMM */
--
Best regards,
Igor Kozhukhov

Quoted 5 lines

The structure is variable length depending on whether the VM has enabled AVX support.

It is rather unfortunate that we have non-complient C used to specify the ABI.

Quoted 7 lines

can we use here ?
struct { char x[1]; } ymm;

it will fix my problem.

-Igor

No, it wont.

The 'ymm' is either not present and has a size of 0 as far as save_area is concerned, or is present, and has a size of 16 * 256bit registers.

The content of this structure is only relevant as far as hvm_{save,load}_cpu_xsave_states() goes, which resorts to some pointer-trickary to move the data. Changing that char x[0] to char x[1] will break the pointer trickary, and migration will suffer an ABI breakage.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 5 lines · Andrew Cooper

The content of this structure is only relevant as far as hvm_{save,load}_cpu_xsave_states() goes, which resorts to some pointer-trickary to move the data. Changing that char x[0] to char x[1] will break the pointer trickary, and migration will suffer an ABI breakage.

The pointer-trickery will need updating at the same time then, that's not rocket science and the use of a single char array is the normal portable way to do these sorts of variable length suffixes to structs.

Ian.